package com.itheima.config;

import com.itheima.interceptor.MyInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration //表示该类是配置类
public class InterceptorConfig implements WebMvcConfigurer {
    //配置自定义拦截

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new MyInterceptor())
                .addPathPatterns("/user/**")  //要拦截的路径
                .excludePathPatterns("/user/findAll"); //忽略的路径
    }
}
